home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import os
- import os.path as os
- import apt_pkg
- (COL_CAT_NAME, COL_CAT_ITEM) = range(0, 2)
- (COL_NAME, COL_ITEM, COL_POPCON) = range(3)
-
- def get_maintenance_end_date(release_date, m_months):
- '''
- get the (year, month) tuple when the maintenance for the distribution
- ends
- '''
- years = m_months / 12
- months = m_months % 12
- support_end_year = release_date.year + years + (release_date.month + months) / 12
- support_end_month = (release_date.month + months) % 12
- return (support_end_year, support_end_month)
-
-
- def get_release_date_from_release_file(path):
- '''
- return the release date as time_t for the given release file
- '''
- if not path or not os.path.exists(path):
- return None
- tag = apt_pkg.ParseTagFile(open(path))
- tag.Step()
- if not tag.Section.has_key('Date'):
- return None
- date = tag.Section['Date']
- return apt_pkg.StrToTime(date)
-
-
- def get_release_filename_for_pkg(cache, pkgname, label, release):
- ''' get the release file that provides this pkg '''
- if not cache.has_key(pkgname):
- return None
- pkg = cache[pkgname]
- ver = None
- for aver in pkg._pkg.VersionList:
- if aver == None or aver.FileList == None:
- continue
-
- for verFile, index in aver.FileList:
- if verFile.Origin == label and verFile.Label == label and verFile.Archive == release:
- ver = aver
- continue
-
-
- if not ver:
- return None
- indexfile = cache._list.FindIndex(ver.FileList[0][0])
- for metaindex in cache._list.List:
- for m in metaindex.IndexFiles:
- if indexfile and indexfile.Describe == m.Describe and indexfile.IsTrusted:
- dir = apt_pkg.Config.FindDir('Dir::State::lists')
- name = apt_pkg.URItoFileName(metaindex.URI) + 'dists_%s_Release' % metaindex.Dist
- return dir + name
-
-
-
-
- def xmlescape(s):
- escape = escape
- import xml.sax.saxutils
- if s == None:
- return ''
- return escape(s)
-
-
- def iterate_list_store(store, it):
- ''' iterate over a gtk tree-model, returns a gtk.TreeIter for each element
- '''
- if not it:
- raise StopIteration
- it
- yield it
- while True:
- it = store.iter_next(it)
- if it == None:
- raise StopIteration
- it == None
- yield it
-
-